package com.gzs.learn.payment.inf.enums;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

@Getter
public enum OrderQueryEnum {
	// 按照流水号查询
	BY_SERIAL(1, "by_serial"),

	// 按照订单号查询
	BY_ORDER(2, "by_serial"),

	// 按照退款流水号查询
	BY_REFUND_SERIAL(3, "by_refund_serial"),


	;

	private static final Map<Integer, OrderQueryEnum> HOLDER_MAP = new HashMap<>();
	static {
		for (OrderQueryEnum e : values()) {
			HOLDER_MAP.put(e.getCode(), e);
		}
	}

	private final int code;
	private final String desc;

	OrderQueryEnum(int code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	public static OrderQueryEnum convert(int code) {
		return HOLDER_MAP.get(code);
	}
}
